/*
 *  Copyright (c) 2022 ZhuHai Jieli Technology Co.,Ltd.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

#ifndef _IIC_SOFT_H_
#define _IIC_SOFT_H_

#include "generic/typedef.h"

typedef const int soft_iic_dev;

struct soft_iic_config {
    int scl;
    int sda;
    u32 delay;
    u8 io_pu;
};

extern const struct soft_iic_config soft_iic_cfg[];

int soft_iic_init(soft_iic_dev iic);
void soft_iic_uninit(soft_iic_dev iic);
void soft_iic_suspend(soft_iic_dev iic);
void soft_iic_resume(soft_iic_dev iic);
void soft_iic_start(soft_iic_dev iic);
void soft_iic_stop(soft_iic_dev iic);
u8 soft_iic_tx_byte(soft_iic_dev iic, u8 byte);
u8 soft_iic_rx_byte(soft_iic_dev iic, u8 ack);
int soft_iic_read_buf(soft_iic_dev iic, void *buf, int len);
int soft_iic_write_buf(soft_iic_dev iic, const void *buf, int len);
#endif

